<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="ie=edge" http-equiv="X-UA-Compatible">
    <title>Document</title>
    <script src="./vue.global.js"></script>
    <link href="./index.css" rel="stylesheet"/>
    <link href="./table.css" rel="stylesheet"/>
    <link href="./pugong.css" rel="stylesheet"/>
    <script src="./index.full.js"></script>

    <script>
        //适配代码
        (function (doc, win) {
            var docEI = doc.documentElement,
                resizeEvt = 'orientationchange' in window ? 'orientataionchange' : 'resize',
                recalc = function () {
                    var clientWidth = docEI.clientWidth;
                    if (!clientWidth) return;
                    //100是字体大小，1536是开发时浏览器窗口的宽度，等比计算
                    docEI.style.fontSize = 100 * (clientWidth / 1536) + 'px';
                }

            if (!doc.addEventListener) return;
            win.addEventListener(resizeEvt, recalc, false);
            doc.addEventListener('DOMContentLoaded', recalc, false);
        })(document, window);
    </script>
    <style>
        * {
            /* margin: 0;
    padding: 0; */
            font-size: 0.15rem;
        }

        .top-content {
            text-align: center;
        }

        .top-img {
            display: block;
            width: 1.5rem;
            margin: auto;
        }

        .top-title {
            font-size: 0.3rem;
            word-spacing: 10px;
            margin: 0.6rem 0;
        }

        .top-text {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .top-input {
            width: 200px;
        }

        .top-input .el-input__wrapper {
            box-shadow: none;
            border-bottom: 1px solid #333;
            border-radius: 0;
            text-align: center;
        }

        .top-input .el-input__inner {
            text-align: center;
        }

        .top-text span {
            display: inline-block;
            font-size: 0.22rem;
            width: 1rem;
            text-align: justify;
            text-align-last: justify;
        }

        .top-company {
            font-size: 0.2rem;
            word-spacing: 10px;
        }

        .red-text {
            color: red;
        }

        .el-input.is-disabled .el-input__wrapper {
            box-shadow: none;
            background-color: transparent;
        }

        .el-input.is-disabled .el-input__inner {
            color: #000;
            -webkit-text-fill-color: #000;
        }
    </style>
</head>

<body>
<div id="app">
    <div class="container">

        <div class="anchorPointMenu">
            <el-menu @select="handleMenuSelect">
                <el-menu-item index="iframe-health"><span v-bind:class="{'red-text': !isFillAll('healthForm') }">员工健康状况调查表
							</span></el-menu-item>

                <el-menu-item :disabled="!isFillAll('healthForm')" index="iframe-educate">
							<span v-bind:class="{'red-text':isFillAll('healthForm')&&!isFillAll('educateForm') }">
								员工入场三级安全教育登记表</span></el-menu-item>


                <el-menu-item :disabled="!isFillAll('educateForm') " index="examQuestions">
                    <span>员工入场安全教育考试试题（{{topForm.job}}）</span></el-menu-item>

                <el-menu-item :disabled="!isFillAll('educateForm') " index="iframe-use">
							<span
                                    v-bind:class="{'red-text': isFillAll('educateForm')&&!isFillAll('useForm') }">正确使用安全防护用品承诺书</span>
                </el-menu-item>

                <el-menu-item :disabled="!isFillAll('useForm') " index="iframe-promise">
							<span
                                    v-bind:class="{'red-text': isFillAll('useForm') &&!isFillAll('promiseForm') }">安全生产承诺书</span>
                </el-menu-item>

                <el-menu-item :disabled="!isFillAll('promiseForm') " index="iframe-responsible">
							<span
                                    v-bind:class="{'red-text':isFillAll('promiseForm')&& !isFillAll('responsibleForm') }">安全责任书</span>
                </el-menu-item>

                <el-menu-item :disabled="!isFillAll('responsibleForm') " index="iframe-fire">
							<span
                                    v-bind:class="{'red-text':isFillAll('responsibleForm')&&! isFillAll('fireForm') }">消防安全承诺书</span>
                </el-menu-item>

                <el-menu-item :disabled="!isFillAll('fireForm') " index="iframe-station">
							<span
                                    v-bind:class="{'red-text':isFillAll('fireForm') &&! isFillAll('stationForm') }">岗位危险告知书</span>
                </el-menu-item>

                <el-menu-item :disabled="!isFillAll('stationForm') " index="iframe-job">
							<span
                                    v-bind:class="{'red-text':isFillAll('stationForm')&&! isFillAll('jobForm') }">职业危害告知书</span>
                </el-menu-item>

                <el-menu-item :disabled="!isFillAll('jobForm') " index="iframe-operate"
                              v-if="topForm.job!='作业队伍管理人员'">
							<span
                                    v-bind:class="{'red-text':isFillAll('jobForm')&&! isFillAll('operateForm') }">安全操作规程告知书</span>
                </el-menu-item>
            </el-menu>

            <!-- <el-button :disabled="!isFillAll('all')" type="primary" @click="onsubmit()">
                提交
            </el-button> -->
            <el-button @click="onsubmit()" type="primary">
                提交
            </el-button>
        </div>


        <div class="contentWord ">

            <div class="top-content">
                <img alt="" class="top-img" src="./图片1.png" srcset="">
                <h2 class="top-title">员 工 教 育 培 训 档 案</h2>
                <h3 class="top-text"><span>编 号</span>
                    <el-input class="top-input" placeholder=" " v-model="topForm.number"></el-input>
                </h3>
                <h3 class="top-text"><span>所属单位</span>
                    <el-input class="top-input" placeholder=" " v-model="topForm.company"></el-input>
                </h3>
                <h3 class="top-text"><span>姓 名</span>
                    <el-input class="top-input" placeholder=" " v-model="topForm.name"></el-input>
                </h3>
                <h3 class="top-text"><span>工 种</span>
                    <el-input class="top-input" placeholder=" " v-model="topForm.job"></el-input>
                </h3>
                <div class="top-company" style="margin: 60px 0 20px 0;">中国水利水电第十四工程局有限公司</div>
                <div class="top-company">引江补汉工程土建施工及金结机电安装8标项目经理部</div>
            </div>


            <!-- <iframe  id="iframe-menu"  width="100%" height="600px"  src="./目录.html"  frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> -->
            <!-- 1 -->
            <!-- <iframe border="0" frameborder="no" height="4500px" id="iframe-aaa" marginheight="0"
            marginwidth="0" scrolling="no" src="./钻孔桩技术交底.html" width="100%"></iframe> -->
             <!-- <iframe border="0" frameborder="no" height="2000px" id="iframe-promise" marginheight="0"
            marginwidth="0" scrolling="no" src="./进场须知.html" width="100%"></iframe> -->
            <iframe border="0" frameborder="no" height="1000px" id="iframe-health" marginheight="0"
                    marginwidth="0" scrolling="no" src="./员工健康状况调查表.html" width="100%"></iframe>
            <!-- 2 -->
            <iframe border="0" frameborder="no" height="1800px"
                    id="iframe-educate" marginheight="0"
                    marginwidth="0" scrolling="no" src="./员工入场三级安全教育登记表.html" width="100%"></iframe>

            <!--3 安全教育考试题-->
            <div class="table-content" id="examQuestions" style="text-align: left;">
                <h3 style="font-size: 0.25rem;text-align: center;">员工入场安全教育考试试题（{{topForm.job}}）</h3>

                <div class="test-top">
                    <div class="test-top-item">
                        <span>单位: </span>
                        <el-input class="promise-input" v-model="testForm.team"></el-input>
                    </div>
                    <div class="test-top-item">
                        <span>姓名：</span>
                        <el-input class="promise-input" v-model="testForm.name"></el-input>
                    </div>

                    <div class="test-top-item">
                        <span>得分：</span>
                        <el-input class="promise-input" v-model="testForm.score"></el-input>
                    </div>
                </div>
                <div class="test-one">
                    <h3>{{trainBankChildResDTO.checkTitle}}</h3>
                    <!-- <h3>{{questionScores.multipleChoices}}</h3> -->
                    <div :key="index" class="question" v-for="(item,index) in trainBankChildResDTO.checkList">
                        <div class="question-title">{{index + 1}}、{{item.name}}:(
                            <el-input class="people-input"
                                      disabled="true"
                                      v-model="trainBankChildResDTO.checkList[index].personAnswer"></el-input>
                            )
                        </div>
                        <div class="question-item">
                            <el-checkbox-group class="checkbox"
                                               v-model="trainBankChildResDTO.checkList[index].personAnswer">
                                <el-checkbox :label="item1.label" :value="item1.value"
                                             v-for="(item1,ind) in formatAnswerContent(item.content)"/>
                                {{item1.label}}
                            </el-checkbox-group>

                        </div>
                    </div>

                    <h3>{{trainBankChildResDTO.radioTitle}}</h3>
                    <!-- <h3>{{questionScores.radioChoices}}</h3> -->
                    <div :key="index" class="question" v-for="(item,index) in trainBankChildResDTO.radioList">
                        <div class="question-title">{{index + 1}}、{{item.name}}(
                            <el-input class="people-input"
                                      disabled="true"
                                      v-model="trainBankChildResDTO.radioList[index].personAnswer"></el-input>
                            )
                        </div>
                        <div class="question-item1">
                            <el-radio-group v-model="trainBankChildResDTO.radioList[index].personAnswer">
                                <el-radio :value="item1.value"
                                          v-for="(item1,ind) in formatAnswerContent(item.content)">{{item1.label}}
                                </el-radio>
                            </el-radio-group>
                        </div>
                    </div>

                    <h3>{{trainBankChildResDTO.panDuanTitle}}</h3>
                    <!-- <h3>{{questionScores.trueFalseChoices}}</h3> -->
                    <div class="question" v-for="(item,index) in trainBankChildResDTO.panDuanList">
                        <div class="question-title1">(
                            <el-radio-group v-model="trainBankChildResDTO.panDuanList[index].personAnswer">
                                <el-radio :value="1">√</el-radio>
                                <el-radio :value="2">×</el-radio>
                            </el-radio-group>
                            ){{index + 1}}.{{item.name}}
                        </div>
                    </div>
                </div>
            </div>
            <!-- 4 -->
            <iframe border="0" frameborder="no" height="1200px" id="iframe-use"
                    marginheight="0" marginwidth="0"
                    scrolling="no" src="./正确使用安全防护用品承诺书.html" width="100%"></iframe>


            <!-- 5 -->
            <iframe border="0" frameborder="no" height="900px" id="iframe-promise" marginheight="0"
                    marginwidth="0"
                    scrolling="no" src="./安全生产承诺书.html" width="100%"></iframe>

            <!-- 6 -->
            <iframe border="0" frameborder="no" height="1300px" id="iframe-responsible" marginheight="0"
                    marginwidth="0"
                    scrolling="no" src="./安全责任书.html" width="100%"></iframe>
            <!-- 7 -->
            <iframe border="0" frameborder="no" height="800px" id="iframe-fire" marginheight="0" marginwidth="0"
                    scrolling="no" src="./消防安全承诺书.html" width="100%"></iframe>

            <!-- 8 -->
            <!-- <iframe :src="'./岗位危险告知书-'+topForm.job+'.html'" border="0" frameborder="no" height="2000px"
                    id="iframe-station" marginheight="0" marginwidth="0" scrolling="no"
                    v-if="topForm.job"
                    width="100%"></iframe> -->
                    <iframe src="./岗位危险告知书-普工.html" border="0" frameborder="no" height="2000px"
                    id="iframe-station" marginheight="0" marginwidth="0" scrolling="no"
                    v-if="topForm.job"
                    width="100%"></iframe>


            <!-- 9 -->
            <!-- <iframe :src="jobCommon.includes(topForm.job)?'./职业危害告知书-普工.html':'./职业危害告知书.html'"
                    border="0" frameborder="no"
                    height="1400px"
                    id="iframe-job" marginheight="0"
                    marginwidth="0" scrolling="no" width="100%"></iframe> -->
                    <iframe src="./职业危害告知书-普工.html"
                    border="0" frameborder="no"
                    height="1400px"
                    id="iframe-job" marginheight="0"
                    marginwidth="0" scrolling="no" width="100%"></iframe>

            <!-- 10 -->
            <!-- <iframe :src="'./安全操作规程告知书-'+topForm.job+'.html'" border="0" frameborder="no" height="4000px"
                    id="iframe-operate" marginheight="0" marginwidth="0" scrolling="no"
                    v-if="topForm.job&&topForm.job!='作业队伍管理人员'"
                    width="100%"></iframe> -->
                    <iframe src="./安全操作规程告知书-普工.html" border="0" frameborder="no" height="4000px"
                    id="iframe-operate" marginheight="0" marginwidth="0" scrolling="no"
                    v-if="topForm.job&&topForm.job!='作业队伍管理人员'"
                    width="100%"></iframe>


        </div>
    </div>
</div>
</div>
<script>
    const {
        createApp,
        reactive,
        toRefs,
        ref,
        onMounted
    } = Vue;
    const vue3Composition = {
        setup() {
            const radioChoices = '一、选择题，请将正确的选项填入括号内，每题5分，共计50分。'
            const trueFalseChoices = '二、判断题（正确打“√”，错误打“×”，每题5分，共计50分）'
            const questionUser = ['电焊工', '普工', '起重工','挖机司机','车辆驾驶员','钢筋工','架子工','模板工','混凝土工','涉爆人员','开挖工','支护工','厨师']
            const questionList = [
                {
                    job: '作业队伍管理人员',
                    multipleChoices: '一、多项选择题 （每题3分，共30分；多选、漏选、错选都不得分）',
                    radioChoices: '二、单项选择题（每小题3分，共30分）',
                    trueFalseChoices: '三、判断题（每小题2分，共40分；在正确的括号内打“√”，在错误的括号内打“×”。）'
                },
                {
                    job: '电工',
                    multipleChoices: '一、多项选择题 （每题5分，共20分；多选、漏选、错选都不得分）',
                    radioChoices: '二、单项选择题（每题4分，共40分）',
                    trueFalseChoices: '三、判断题（每小题4分，共40分；在正确的括号内打“√”，在错误的括号内打“×”。）'
                },
                {
                    job: '装载机司机',
                    multipleChoices: '一、多项选择题 （每题6分，共30分；多选、漏选、错选都不得分）',
                    radioChoices: '二、单项选择题（每题3分，共30分）',
                    trueFalseChoices: '三、判断题（每小题4分，共40分；在正确的括号内打“√”，在错误的括号内打“×”。）'
                },
                {
                    job: '压路机司机',
                    multipleChoices: '',
                    radioChoices: '一、单项选择题（每题4分，共40分）',
                    trueFalseChoices: '二、判断题（每小题4分，共60分；在正确的括号内打“√”，在错误的括号内打“×”。）'
                },
                {
                    job: '推土机司机',
                    multipleChoices: '一、多项选择题 （每题3分，共30分；多选、漏选、错选都不得分）',
                    radioChoices: '二、单项选择题（每题3分，共30分）',
                    trueFalseChoices: '三、判断题（每小题4分，共40分；在正确的括号内打“√”，在错误的括号内打“×”。）'
                },
            ]
            questionUser.forEach(item => {
                questionList.push({
                    job: item,
                    multipleChoices: '',
                    radioChoices: radioChoices,
                    trueFalseChoices: trueFalseChoices
                })
            })
            const questionScores = ref({
                multipleChoices: '',
                radioChoices: '',
                trueFalseChoices: ''
            })
            const isFillAll = (key) => {
                let flag = true
                if (key == 'all') {
                    let mustArr = mustData.value
                    if (topForm.value.job == '作业队伍管理人员') mustArr = mustArr.slice(0, mustArr.length - 1);
                    mustArr.forEach(item => {
                        item.keys.forEach(item => {
                            if (!item.isFill) flag = false
                        })
                    })
                } else {
                    let arr = mustData.value.find(item => item.form == key)
                    arr.keys.forEach(item => {
                        if (!item.isFill) flag = false
                    })
                }

                return flag
            }

            window.addEventListener('message', e => {
                    let data = e.data
                    let keys = mustData.value.find(item => item.form == data.form)
                    keys.keys.find(item => item.key == data.key).isFill = data.isFill
                    
                });
            //必填字段
            const mustData = ref([{
                // 员工健康状况调查表
                // 本人签名
                form: 'healthForm',
                keys: [{
                    key: 'signSelf',
                    isFill: false
                },{
                    key: 'height',
                    isFill: false
                },{
                    key: 'weight',
                    isFill: false
                },{
                    key: 'medicalHistory',
                    isFill: false
                },{
                    key: 'radio1',
                    isFill: false
                },{
                    key: 'radio2',
                    isFill: false
                },{
                    key: 'radio4',
                    isFill: false
                },{
                    key: 'radio5',
                    isFill: false
                },{
                    key: 'radio6',
                    isFill: false
                }]
                },
                {
                    // 员工入场三级安全教育登记表
                    // 承诺人签名 教育人，被教育人三个
                    form: 'educateForm',
                    keys: [{
                        key: 'promiseSign',
                        isFill: false
                    }, {
                        key: 'teached1',
                        isFill: false
                    }, {
                        key: 'teacher1',
                        isFill: false
                    }, {
                        key: 'teached2',
                        isFill: false
                    }, {
                        key: 'teacher2',
                        isFill: false
                    }, {
                        key: 'teached3',
                        isFill: false
                    }, {
                        key: 'teacher3',
                        isFill: false
                    },{
                        key: 'culture',
                        isFill: false
                    },{
                        key: 'safeSign',
                        isFill: false
                    }]
                },
                {
                    // 正确使用安全防护用品承诺书
                    // 承诺人
                    form: 'useForm',
                    keys: [{
                        key: 'acceptor',
                        isFill: false
                    },{
                        key: 'canUse',
                        isFill: false
                    },{
                        key: 'person',
                        isFill: false
                    }]
                },
                {
                    // 安全生产承诺书
                    // 承诺人
                    form: 'promiseForm',
                    keys: [{
                        key: 'acceptor',
                        isFill: false
                    },]
                },
                {
                    // 安全责任书
                    // 所在单位负责人 责任人

                    form: 'responsibleForm',
                    keys: [{
                        key: 'responsibler',
                        isFill: false
                    }, {
                        key: 'principal',
                        isFill: false
                    },]
                },
                {
                    // 消防安全承诺书
                    // 消防安全责任承诺人（签名）
                    form: 'fireForm',
                    keys: [{
                        key: 'acceptor',
                        isFill: false
                    },]
                },
                {
                    // 岗位危险告知书
                    // 告知者（签字）被告知者（签字）
                    form: 'stationForm',
                    keys: [{
                        key: 'announcer',
                        isFill: false
                    }, {
                        key: 'announcerd',
                        isFill: false
                    },]
                },
                {
                    // 职业危害告知书
                    // 告知者（签字）被告知者（签字）
                    form: 'jobForm',
                    keys: [{
                        key: 'announcer',
                        isFill: false
                    }, {
                        key: 'announcerd',
                        isFill: false
                    },]
                },
                {
                    // 安全操作规程告知书
                    // 告知者（签字）被告知者（签字）
                    form: 'operateForm',
                    keys: [{
                        key: 'announcer',
                        isFill: false
                    }, {
                        key: 'announcerd',
                        isFill: false
                    },]
                },
            ])
            //使用职业危害一般模板
            const jobCommon = ref(['普工', '起重工', '作业队伍管理人员', '装载机司机', '挖机司机', '压路机司机', '车辆驾驶员', '架子工', '模板工', '混凝土工',
                '推土机司机'
            ])
            const healthSign = ref(false)
            const topForm = ref({
                number: "",
                company: "",
                name: '',
                job: ""
            })
            const testForm = ref({
                name: "",
                qualify: "",
                time: "",
                title: "",
                fraction: "",
                list: [],
                examId: "",
                personCode: "",
            })
            let dataKey = ref()
            //健康状况
            const iframeHealth = ref('');
            //三级安全教育
            const iframeEducate = ref('');
            //正确使用
            const iframeUse = ref('');
            //安全承诺书
            const iframePromise = ref('');
            //安全责任书
            const iframeResponsible = ref('');
            //消防安全承诺书
            const iframeFire = ref('');
            //岗位危险告知书
            const iframeStation = ref('');
            //职业危害告知书
            const iframeJob = ref('');
            //安全操作规程告知书
            const iframeOperate = ref('');
            // onMounted(() => {
            // 	iframeHealth.value = document.getElementById("iframe-health");
            // iframeEducate.value = document.getElementById("iframe-educate");
            // iframeUse.value = document.getElementById("iframe-use");
            // iframePromise.value = document.getElementById("iframe-promise");
            // iframeResponsible.value = document.getElementById("iframe-responsible");
            // iframeFire.value = document.getElementById("iframe-fire");
            // iframeStation.value = document.getElementById("iframe-station");
            // iframeJob.value = document.getElementById("iframe-job");
            // iframeOperate.value = document.getElementById("iframe-operate");
            // })

            window.childListener = function (data) {
                setUpEquipment(data.key, data.type)
            }

            // 使用Date对象进行日期计算
            const addDays = (year, month, day, add) => {
                let newDate = new Date(year, Number(String(month).replace(/^0+/, '')) - 1, Number(String(day).replace(
                    /^0+/, '')) + add);
                return newDate.toLocaleDateString().split('/');
            }
            window.handleMessage = (event) => {
                // console.log("这里是父项目传来的值", event.data);
                // alert(event.data+"这里是父项目传来的值")
                let eventData = JSON.parse(event.data)
                console.log("这里是父项目传来的值", eventData);
                if (eventData.type == 1) {
                    let data = eventData.data
                    // console.log(data, "datadatadata")
                    //头部信息
                    topForm.value = data.wordTop
                    if (data.trainBankChildResDTO.checkList) {
                        data.trainBankChildResDTO.checkList = data.trainBankChildResDTO.checkList.map(item => {
                            return {...item, personAnswer: []}
                        })
                    }
                    if (data.trainBankChildResDTO.panDuanList) {
                        data.trainBankChildResDTO.panDuanList = data.trainBankChildResDTO.panDuanList.map(item => {
                            return {...item, personAnswer: ''}
                        })
                    }
                    if (data.trainBankChildResDTO.radioList) {
                        data.trainBankChildResDTO.radioList = data.trainBankChildResDTO.radioList.map(item => {
                            return {...item, personAnswer: ''}
                        })
                    }
                    //试题部分
                    trainBankChildResDTO.value = data.trainBankChildResDTO

                    testForm.value = data?.userAnswerVo
                    testForm.value.team = topForm.value.company
                    topForm.value.number = ''

                    //日期添加
                    let add2 = addDays(data.wordEducate.year1, data.wordEducate.month1, data.wordEducate.day1, 2)
                    data.wordEducate.year1 = add2[0]
                    data.wordEducate.month1 = add2[1]
                    data.wordEducate.day1 = add2[2]
                    let add5 = addDays(data.wordEducate.year2, data.wordEducate.month2, data.wordEducate.day2, 5)
                    data.wordEducate.year2 = add5[0]
                    data.wordEducate.month2 = add5[1]
                    data.wordEducate.day2 = add5[2]
                    let add7 = addDays(data.wordEducate.year3, data.wordEducate.month3, data.wordEducate.day3, 7)
                    data.wordEducate.year3 = add7[0]
                    data.wordEducate.month3 = add7[1]
                    data.wordEducate.day3 = add7[2]
                    data.wordEducate.year5 = add7[0]
                    data.wordEducate.month5 = add7[1]
                    data.wordEducate.day5 = add7[2]
                    data.wordEducate.year4 = add7[0]
                    data.wordEducate.month4 = add7[1]
                    data.wordEducate.day4 = add7[2]

                    data.wordUse.date = add7.join('-')
                    data.wordUse.year = add7[0]
                    data.wordUse.month = add7[1]
                    data.wordUse.day = add7[2]

                    data.wordPromise.year = add7[0]
                    data.wordPromise.month = add7[1]
                    data.wordPromise.day = add7[2]

                    data.wordResponsible.year = add7[0]
                    data.wordResponsible.month = add7[1]
                    data.wordResponsible.day = add7[2]
                    data.wordResponsible.year1 = add7[0]
                    data.wordResponsible.month1 = add7[1]
                    data.wordResponsible.day1 = add7[2]

                    data.wordFire.year = add7[0]
                    data.wordFire.month = add7[1]
                    data.wordFire.day = add7[2]

                    data.wordStation.year = add7[0]
                    data.wordStation.month = add7[1]
                    data.wordStation.day = add7[2]
                    data.wordStation.year1 = add7[0]
                    data.wordStation.month1 = add7[1]
                    data.wordStation.day1 = add7[2]

                    data.wordJob.year = add7[0]
                    data.wordJob.month = add7[1]
                    data.wordJob.day = add7[2]
                    data.wordJob.year1 = add7[0]
                    data.wordJob.month1 = add7[1]
                    data.wordJob.day1 = add7[2]

                    data.wordOperate.year = add7[0]
                    data.wordOperate.month = add7[1]
                    data.wordOperate.day = add7[2]
                    data.wordOperate.year1 = add7[0]
                    data.wordOperate.month1 = add7[1]
                    data.wordOperate.day1 = add7[2]

                    data.wordUse.idCard = data.wordEducate.idNumber
                    data.wordUse.name = data.wordTop.name
                    data.wordUse.workType = data.wordTop.job

                    questionScores.value = questionList.find(item => item.job == data.wordTop.job)

                    setTimeout(() => {
                        iframeHealth.value = document.getElementById("iframe-health");
                        iframeEducate.value = document.getElementById("iframe-educate");
                        iframeUse.value = document.getElementById("iframe-use");
                        iframePromise.value = document.getElementById("iframe-promise");
                        iframeResponsible.value = document.getElementById("iframe-responsible");
                        iframeFire.value = document.getElementById("iframe-fire");
                        iframeStation.value = document.getElementById("iframe-station");
                        iframeJob.value = document.getElementById("iframe-job");
                        iframeOperate.value = document.getElementById("iframe-operate");
                        //设置默认值
                        iframeHealth.value.contentWindow.setData(data.wordHealth)
                        iframeEducate.value.contentWindow.setData(data.wordEducate)
                        iframeUse.value.contentWindow.setData(data.wordUse)
                        iframePromise.value.contentWindow.setData(data.wordPromise)
                        iframeResponsible.value.contentWindow.setData(data.wordResponsible)
                        iframeFire.value.contentWindow.setData(data.wordFire ?? {})
                        // iframeStation.value.contentWindow.setData(data.wordStation ?? {})
                        iframeJob.value.contentWindow.setData(data.wordJob ?? {})
                        // iframeOperate.value.contentWindow.setData(data.wordOperate ?? {})
                        if (!jobCommon.value.includes(topForm.value.job)) iframeJob.value.contentWindow.setJob(topForm
                            .value.job)
                    }, 3000);


                } else {
                    let dataKeyArr = dataKey.value.split('.')
                    console.log(dataKeyArr, 'dataKeyArr')
                    let iframeDate = ''
                    if (dataKeyArr[0] == 'healthForm') {
                        iframeDate = iframeHealth.value
                    } else if (dataKeyArr[0] == 'educateForm') {
                        iframeDate = iframeEducate.value
                    } else if (dataKeyArr[0] == 'useForm') {
                        iframeDate = iframeUse.value
                    } else if (dataKeyArr[0] == 'promiseForm') {
                        iframeDate = iframePromise.value
                    } else if (dataKeyArr[0] == 'responsibleForm') {
                        iframeDate = iframeResponsible.value
                    } else if (dataKeyArr[0] == 'fireForm') {
                        iframeDate = iframeFire.value
                    } else if (dataKeyArr[0] == 'stationForm') {
                        iframeDate = iframeStation.value
                    } else if (dataKeyArr[0] == 'jobForm') {
                        iframeDate = iframeJob.value
                    } else if (dataKeyArr[0] == 'operateForm') {
                        iframeDate = iframeOperate.value
                    }
                    if (iframeDate) {
                        console.log(iframeDate, 'iframeDate')
                        let mustArr = mustData.value.find(item => item.form == dataKeyArr[0])
                        mustArr.keys.forEach(item => {
                            if (item.key == dataKeyArr[1]) item.isFill = true
                        })
                        iframeDate.contentWindow.setSign({
                            img: 'data:image/png;base64,' + eventData.data + '',
                            key: dataKeyArr[1]
                        })
                    }
                }

            };
            function handleMenuSelect(index) {
                const anchor = document.getElementById(index);
                if (anchor) {
                    anchor.scrollIntoView({
                        behavior: 'smooth'
                    });
                }
            }

            const trainBankChildResDTO = ref({
                checkList: [],
                radioList: [],
                panDuanList: [],
            })

            const formatAnswerContent = (data) => {
                const alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
                const dataArr = JSON.parse(data)
                if (dataArr && dataArr.length) {
                    return dataArr.map((item, index) => ({
                        label: item,
                        value: alphabet[index]
                    }))
                } else {
                    return []
                }
            }

            //peopleForm.sign
            const setUpEquipment = (key, type) => {
                console.log(key,'===setUpEquipment==key')
                dataKey.value = key
                //提交这么写
                // window.parent.postMessage(type, "*");
                // window.parent.postMessage("hello，我即将传给父项目", "*");
                window.parent.childListener({
                    data: type
                });
            }

            const onsubmit = () => {

                // console.log(iframeHealth.value.contentWindow.getData(), '员工健康状况调查表');
                // console.log(iframeEducate.value.contentWindow.getData(), '员工入场三级安全教育登记表');
                console.log(iframeUse.value.contentWindow.getData(), '正确使用安全防护用品承诺书');
                // console.log(iframePromise.value.contentWindow.getData(), '安全生产承诺书');
                // console.log(iframeResponsible.value.contentWindow.getData(), '安全责任书');
                // console.log(iframeFire.value.contentWindow.getData(), '消防安全承诺书');
                // console.log(iframeStation.value.contentWindow.getData(), '岗位危险告知书');
                // console.log(iframeJob.value.contentWindow.getData(), '职业危害告知书');
                // console.log(iframeOperate.value.contentWindow.getData(), '安全操作规程告知书');
                // return

                const mergedArray = [...trainBankChildResDTO.value.checkList,
                    ...trainBankChildResDTO.value.radioList, ...trainBankChildResDTO.value.panDuanList
                ];
                testForm.value.list = mergedArray
                let dataJson = {
                    wordHealth: iframeHealth.value.contentWindow.getData(),
                    wordEducate: iframeEducate.value.contentWindow.getData(),
                    wordUse: iframeUse.value.contentWindow.getData(),
                    wordPromise: iframePromise.value.contentWindow.getData(),
                    wordResponsible: iframeResponsible.value.contentWindow.getData(),
                    wordFire: iframeFire.value.contentWindow.getData(),
                    wordStation: iframeStation.value.contentWindow.getData(),
                    wordJob: iframeJob.value.contentWindow.getData(),
                    userAnswerVo: testForm.value,
                    wordTop: topForm.value,
                }
                // console.log(JSON.stringify(dataJson));
                if (topForm.value.job != '作业队伍管理人员') dataJson.wordOperate = iframeOperate.value.contentWindow.getData()
                let data = {
                    type: "form-j",
                    dataJson
                }

                window.parent.childListener({
                    data: JSON.stringify(data)
                });

            }


            return {
                jobCommon,
                topForm,
                testForm,
                setUpEquipment,
                handleMenuSelect,
                trainBankChildResDTO,
                formatAnswerContent,
                onsubmit,
                isFillAll,
                questionScores
            }
        }

    }
    const app = createApp(vue3Composition).use(ElementPlus).mount('#app');
</script>
</body>


</html>